<template>
  <div class="mylove">
    <div class="title">我的关注 ({{ this.follow.length }})</div>
    <div class="myloveList" v-if="this.follow.length">
      <singer-card :singerInfo="follow"></singer-card>
    </div>
    <div v-else class="alternate">暂无关注</div>
  </div>
</template>

<script>
let userId = JSON.parse(localStorage.getItem("userInfo")).userId;

import SingerCard from "../../../components/singerCard/SingerCard.vue";
export default {
  components: { SingerCard },
  name: "MyLove",
  data() {
    return {
      follow: [],
    };
  },

  mounted() {
    this.getMyLove();
  },

  methods: {
    // 获取我的关注
    async getMyLove() {
      const { data: res } = await this.$http("/user/follows", {
        params: {
          uid: userId,
        },
      });
      //   console.log(res);
      this.follow = res.follow;
    },
  },
};
</script>

<style lang="less" scoped>
.mylove {
  .title {
    width: 100%;
    height: 40px;
    color: #666666;
    border-bottom: 2px solid #e03a24;
    font-size: 20px;
  }
  .alternate {
    display: flex;
    justify-content: center;
    height: 40vh;
    align-items: center;
    color: #666666;
    font-size: 20px;
  }
}
</style>